import re
import logging

CONSUMER_KEY = 'DZXpjnadyKUNyuRVQe3LVQ'
CONSUMER_SECRET = 'no9GqvAG4wfUo5zh1PsK7qO9AGMxNwOfk5AHZTkz1EU'

LOCAL_CONSUMER_KEY = 'SiSr2M8vblXzWEO09TswA'
LOCAL_CONSUMER_SECRET = 'XUheWyYRiEvYzWOlAsGs49astac0RmFhSJcjCtOTI'

CALLBACK = None

TWITTER_ACCOUNT = 'share4charity'  #share4charity@gmail.com:twitter123456
LOCAL_TWITTER_ACCOUNT = 'share4charity_l' #share4charitylocal@gmail.com:twitter123456

DEPLOYMENT_URL_PATTER = r'localhost|127.0.0.1'

def get_app_twitter_account(url):
    if len(re.findall(DEPLOYMENT_URL_PATTER, url)) > 0:
        logging.info(LOCAL_TWITTER_ACCOUNT)
        return LOCAL_TWITTER_ACCOUNT
    else:
        return TWITTER_ACCOUNT
    
def is_app_twitter_account(user_account, url):
    return user_account == get_app_twitter_account(url)
    
def get_consumer_key(url):
    if len(re.findall(DEPLOYMENT_URL_PATTER, url)) > 0:
        logging.info(LOCAL_CONSUMER_KEY)
        return LOCAL_CONSUMER_KEY
    else:
        return CONSUMER_KEY

def get_consumer_secret(url):
    if len(re.findall(DEPLOYMENT_URL_PATTER, url)) > 0:
        logging.info(LOCAL_CONSUMER_SECRET)
        return LOCAL_CONSUMER_SECRET
    else:
        return CONSUMER_SECRET
    
    
